package com.zhpan.indicator.options;

import ohos.agp.components.AttrHelper;
import ohos.agp.utils.Color;
import ohos.app.Context;

import com.zhpan.indicator.enums.IndicatorSlideMode;

/**
 * 配置类
 *
 * @since 2021-04-13
 */
public class IndicatorOptions {
    private int orientation;
    private int indicatorStyle;
    private int slideMode;
    private int pageSize;
    private Color normalSliderColor;
    private Color checkedSliderColor;
    private float sliderGap;
    private float sliderHeight;
    private float normalSliderWidth;
    private float checkedSliderWidth;
    private int currentPosition;
    private int realPosition;
    private float slideProgress;

    /**
     * 创建配置
     *
     * @param context 上下文
     */
    public IndicatorOptions(Context context) {
        normalSliderWidth = AttrHelper.vp2px(8.0F, context);
        checkedSliderWidth = normalSliderWidth;
        sliderGap = normalSliderWidth;
        normalSliderColor = new Color(Color.getIntColor("#8C18171C"));
        checkedSliderColor = new Color(Color.getIntColor("#8C6C6D72"));
        slideMode = IndicatorSlideMode.NORMAL;
    }

    public int getOrientation() {
        return orientation;
    }

    public void setOrientation(int orientation) {
        this.orientation = orientation;
    }

    public int getIndicatorStyle() {
        return indicatorStyle;
    }

    public void setIndicatorStyle(int indicatorStyle) {
        this.indicatorStyle = indicatorStyle;
    }

    public int getSlideMode() {
        return slideMode;
    }

    public void setSlideMode(int slideMode) {
        this.slideMode = slideMode;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public Color getNormalSliderColor() {
        return normalSliderColor;
    }

    public void setNormalSliderColor(Color normalSliderColor) {
        this.normalSliderColor = normalSliderColor;
    }

    public Color getCheckedSliderColor() {
        return checkedSliderColor;
    }

    public void setCheckedSliderColor(Color checkedSliderColor) {
        this.checkedSliderColor = checkedSliderColor;
    }

    public float getSliderGap() {
        return sliderGap;
    }

    public void setSliderGap(float sliderGap) {
        this.sliderGap = sliderGap;
    }

    /**
     * 获取高度
     *
     * @return 高度
     */
    public float getSliderHeight() {
        if (sliderHeight > 0) {
            return sliderHeight;
        } else {
            return normalSliderWidth / 2;
        }
    }

    public void setSliderHeight(float sliderHeight) {
        this.sliderHeight = sliderHeight;
    }

    /**
     * 设置未选中、选中宽度
     *
     * @param normalIndicatorWidth 未选中宽度
     * @param checkedIndicatorWidth 选中宽度
     */
    public void setSliderWidth(float normalIndicatorWidth, float checkedIndicatorWidth) {
        this.normalSliderWidth = normalIndicatorWidth;
        this.checkedSliderWidth = checkedIndicatorWidth;
    }

    public float getNormalSliderWidth() {
        return normalSliderWidth;
    }

    public void setNormalSliderWidth(float normalSliderWidth) {
        this.normalSliderWidth = normalSliderWidth;
    }

    public float getCheckedSliderWidth() {
        return checkedSliderWidth;
    }

    public void setCheckedSliderWidth(float checkedSliderWidth) {
        this.checkedSliderWidth = checkedSliderWidth;
    }

    public int getCurrentPosition() {
        return currentPosition;
    }

    public void setCurrentPosition(int currentPosition) {
        this.currentPosition = currentPosition;
    }

    public float getSlideProgress() {
        return slideProgress;
    }

    public void setSlideProgress(float slideProgress) {
        this.slideProgress = slideProgress;
    }

    public int getRealPosition() {
        return realPosition;
    }

    public void setRealPosition(int realPosition) {
        this.realPosition = realPosition;
    }
}
